﻿using System.Windows.Controls;
using Action = DataLayer.Model.Objects.Action;
using DataLayer.Model.Objects;
using BuisnessLayer;
using System;

namespace Overview.Components
{
    /// <summary>
    /// Interaction logic for ActionControl.xaml
    /// </summary>
    public partial class ActionControl : UserControl
    {
        public Action Action { get; private set; }
        public Image Icon;
        public Macro Macro;
        public ActionControl(Action pAction)
        {
            InitializeComponent();
            Action = pAction;
            ActionImage.ToolTip = pAction.Name;
            if(!String.IsNullOrEmpty(pAction.Icon))
                ActionImage.Source = ImageUtil.BinaryToImageSource(ImageUtil.StringToByteArray(pAction.Icon));
        }

        public ActionControl(Macro pMacro)
        {
            InitializeComponent();
            Macro = pMacro;
            ActionImage.ToolTip = pMacro.Name;
        }
    }
}
